local skel=fk.CreateSkill{
    name="steam__suohu",
    tags={Skill.Compulsory},
}

Fk:loadTranslationTable{
    ["steam__suohu"] = "所呼",
    [":steam__suohu"] = [[锁定技，其他角色进行“选择一项”的操作时，你可添加选项:交给你一张牌，
    若未选择此项你下次对其造成的伤害改为2。<br><br>
    <font color='blue'><b>注意：</b>此技能仅在“选择一项”的操作时生效。且部分技能可能无效，请勿反馈关于该技能的任何报错</font>]],

    ["steam__suohu_choice"] = "交给中行寅一张牌",
    ["#steam__suohu-give"] = "所呼：你可以选择是否交给 %dest 一张牌",
    ["@@steam__suohu_damage"] = "所呼2伤",
}


--原版是改选项算了
skel:addEffect(fk.BeforeRequestAsk ,{
    can_refresh = function(self, event, target, player, data)
        return player:hasSkill(skel.name) and data.command=="AskForChoice"
    end,
    on_refresh = function(self, event, target, player, data)
        local room=player.room
        for _, p in ipairs(data.players) do
            --
            if p~=player and p:isAlive() then
                local askdata=data.data[p.id]
                local choice=askdata[1]
                local all_choices=askdata[2]
                table.insertIfNeed(choice,"steam__suohu_choice")
                table.insertIfNeed(all_choices,"steam__suohu_choice")
                askdata[1]=choice
                askdata[2]=all_choices
                data.data[p.id]=askdata
            end
        end
        
    end,
})

--原版是改选项算了
skel:addEffect(fk.AfterRequestAsk ,{
    can_refresh = function(self, event, target, player, data)
        if player:hasSkill(skel.name) and data.command=="AskForChoice" then
            for _, p in ipairs(data.players) do
                local askdata=data.data[p.id]
                local choice=askdata[1]
                if table.contains(choice,"steam__suohu_choice") then
                    return true
                end
            end
            return false
        end
    end,
    on_refresh = function(self, event, target, player, data)
        local room=player.room
        for _, p in ipairs(data.players) do
            --是否选了给牌
            local result=data.result[p.id]
            if result=="steam__suohu_choice" then
                if not p:isKongcheng() then
                    local card = room:askToCards(p, {
                        skill_name = skel.name,
                        min_num = 1,
                        max_num = 1,
                        include_equip = false,
                        pattern = ".|.|.|hand",
                        prompt = "#steam__suohu-give::"..p.id,
                        cancelable = false,
                    })
                    if #card > 0 then
                        room:obtainCard(player, card, true, fk.ReasonGive, player, skel.name)
                    end
                end
            else
                room:addPlayerMark(p, "@@steam__suohu_damage", 1)
            end
        end
        
    end,
})

--
skel:addEffect(fk.DamageCaused ,{
    can_trigger = function(self, event, target, player, data)
        return player:hasSkill(skel.name) and target==player and data.to:getMark("@@steam__suohu_damage")>0
    end,
    on_use = function(self, event, target, player, data)
        local room=player.room
        data.damgae=2
        room:removePlayerMark(data.to, "@@steam__suohu_damage")
    end
})



return skel